﻿//该文件主要用于显示用户弹出窗口,包括alert窗口的显示,confirm窗口的显示


//显示用户消息窗口,参数msg为用户自定义消息,或者相关输入字符串等.
var MsgDlg=function(msg){
 if($("creator_cmswindowdlgalert")==null)
    {
    if(msg==null)
    msg="";
    var icon="<img src='"+SBasePath+"/images/alphacube/treecp-alert.gif'/>";    
    var str='<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td width="30%"  valign="middle" align="center">'+icon+'</td><td align="left">'+msg+'</td></tr></table>';
    Dialog.alert(str,{windowParameters: {className: "alphacube",width:268},draggable:true, okLabel: "关闭",ok:function(win) { return true},id:"creator_cmswindowdlgalert"});}
}
//显示用户消息窗口,参数msg为用户自定义消息,或者相关输入字符串等.
var MsgDlgs = function(msg) {
    if ($("creator_cmswindowdlgalert") == null) {
        if (msg == null)
            msg = "";
        var icon = "<img src='" + SBasePath + "/images/alphacube/treecp-alert.gif'/>";
        var str = '<table border="0" width="90%" cellpadding="0" cellspacing="0"><tr><td width="30%"  valign="middle" align="center">' + icon + '</td><td align="left">' + msg + '</td></tr></table>';
        Dialog.alert(str, { windowParameters: { className: "alphacube", width: 268 }, draggable: true, okLabel: "关闭", ok: function(win) { return true }, id: "creator_cmswindowdlgalert" });
    }
}

//提交刷表父页面
var MsgDlgSF = function(msg) {
    if ($("creator_cmswindowdlgalert") == null) {
        if (msg == null)
            msg = "";
        var icon = "<img src='" + SBasePath + "/images/alphacube/treecp-alert.gif'/>";
        var str = '<table border="0" width="90%" cellpadding="0" cellspacing="0"><tr><td width="30%"  valign="middle" align="center">' + icon + '</td><td align="left">' + msg + '</td></tr></table>';
        Dialog.alertSf(str, { windowParameters: { className: "alphacube", width: 268 }, draggable: true, okLabel: "关闭", ok: function(win) { return true }, id: "creator_cmswindowdlgalert" });
    }
}

//关闭当前提示窗口，并刷新当前页，删除之后还在当前页
var MsgDlgLocal = function(msg) {
    if ($("creator_cmswindowdlgalert") == null) {
        if (msg == null)
            msg = "";
        var icon = "<img src='" + SBasePath + "/images/alphacube/treecp-alert.gif'/>";
        var str = '<table border="0" width="90%" cellpadding="0" cellspacing="0"><tr><td width="30%"  valign="middle" align="center">' + icon + '</td><td align="left">' + msg + '</td></tr></table>';
        Dialog.alertLocal(str, { windowParameters: { className: "alphacube", width: 268 }, draggable: true, okLabel: "关闭", ok: function(win) { return true }, id: "creator_cmswindowdlgalert" });
    }
}
//关闭当前提示窗口，并刷新当前页，删除之后还在当前页
var MsgDlgBack = function(msg) {
    if ($("creator_cmswindowdlgalert") == null) {
        if (msg == null)
            msg = "";
        var icon = "<img src='" + SBasePath + "/images/alphacube/treecp-alert.gif'/>";
        var str = '<table border="0" width="90%" cellpadding="0" cellspacing="0"><tr><td width="30%"  valign="middle" align="center">' + icon + '</td><td align="left">' + msg + '</td></tr></table>';
        Dialog.alertBack(str, { windowParameters: { className: "alphacube", width: 268 }, draggable: true, okLabel: "关闭", ok: function(win) { return true }, id: "creator_cmswindowdlgalert" });
    }
}
//显示确认窗品,msg为消息,func为调用的函数
var ConfrimDlg=function(msg,func)
{
   if($("creator_cmswindowdlgalert")==null)
    {
    if(msg==null)
        msg="";
    var icon="<img src='"+SBasePath+"/images/alphacube/gif-0308.gif'/>";
    var str='<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td width="20%" valign="middle" align="center">'+icon+'</td><td align="left">'+msg+'</td></tr></table>';
    
    Dialog.confirm(str,{windowParameters: {className: "alphacube",width:268}, draggable:true,okLabel: "是",cancelLabel:"否", cancel:function(win){return false;},
    ok:function(win) { window.setTimeout(func,1); return true},id:"creator_cmswindowdlgalert"});
    }
};
//显示确认窗品,msg为消息,func为调用的确定函数,取消函数
var ConfrimDlg1=function(msg,btn1,btn2,func1,func2)
{
   if($("creator_cmswindowdlgalert")==null)
    {
    if(msg==null)
        msg="";
    var icon="<img src='"+SBasePath+"/images/alphacube/gif-0308.gif'/>";
    var str='<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td width="20%" valign="middle" align="center">'+icon+'</td><td align="left">'+msg+'</td></tr></table>';
    
    Dialog.confirm(str,{windowParameters: {className: "alphacube",width:268}, draggable:true,okLabel: btn1,cancelLabel:btn2, cancel:function(win){window.setTimeout(func2,1); return true},
    ok:function(win) { window.setTimeout(func1,1); return true},id:"creator_cmswindowdlgalert"});
    }
};
//显示确认窗品,msg为消息,func为调用的函数
var InfoDlg=function(msg,func)
{
   if($("creator_cmswindowdlgalert")==null)
    {
    if(msg==null)
        msg="";
    var icon="<img src='"+SBasePath+"/images/gif-0308.gif'/>";
   var str='<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td width="20%" valign="middle" align="center">'+icon+'</td><td align="left">'+msg+'</td></tr></table>';
    
    Dialog.confirm(str,{windowParameters: {className: "alphacube",width:268}, draggable:true,okLabel: "是",cancelLabel:"否", cancel:function(win){return false;},
    ok:function(win) { window.setTimeout(func,1); return true},id:"creator_cmswindowdlgalert"});
    }
};
function ShowLoading(infoStr)
{
    if(infoStr==null || infoStr=="")
    infoStr="";
    return "<span style='height:30px; padding-left:2px;'><img src='"+SBasePath+"/images/alert/progress.gif' border='0' />"+infoStr+"</span>";
}


function ShowLoadingNew()
{
    var _width=250;
    var _height=60;
    var _title="";
    var content = "<span style='height:30px; padding-left:2px;'><img src='"+SBasePath+"/images/alert/progress.gif' border='0' />正在加载请稍后．．．．</span>";
    if($("creator_cmswindowdlg")==null)
    {
    win = new Window("creator_cmswindowdlg", {className: "alphacube", width:''+_width, height:''+_height, zIndex: 100, resizable: true,minimizable:false,maximizable:false, title: ""+_title, showEffect:Element.show, hideEffect:Effect.Fade, draggable:true})
    win.getContent().innerHTML= "<div style='padding:10px' width='100%'> "+content+"</div>" 
    win.setDestroyOnClose();
    win.showCenter();
    return win;
    }
}



function ShowLoadingWaiting()
{
    ShowWaiting("0");
}
function ShowSubmitWaiting()
{
    ShowWaiting("1");
}
//加载等待框架
function ShowWaiting(_1)
{ 
    if($("kt_waiting_window_div")==null)
    {
     var oDiv=document.createElement("DIV");
     oDiv.id="kt_waiting_window_div";
     
     document.body.appendChild(oDiv);
     switch(_1)
     {
        case "0":oDiv.innerHTML=ShowLoading("正在加载...");break;
        case "1":oDiv.innerHTML=ShowLoading("正在提交...");break;
        default:oDiv.innerHTML=ShowLoading("正在加载...");
     }
     oDiv.style.top= "55px";
     //alert(document.body.offsetWidth);
     oDiv.style.left=  document.body.offsetWidth+document.body.offsetLeft-100+"px";
     oDiv.style.width="100px";
     oDiv.style.height="30px";
     oDiv.style.margin= "0 auto";
     oDiv.style.display="block";
     oDiv.style.zIndex="85";
     //oDiv.style.backgroundColor ="EAEAA1";
     oDiv.style.position="absolute";
     oDiv.style.font="12px/1.5em Simsun,Verdana,Arial,Lucida,sans-serif; ";
    } 
};
//关闭等待框架
function CloseWaiting()
{
    if($("kt_waiting_window_div")!=null)
    {
        document.body.removeChild($("kt_waiting_window_div"));
    }
};
function ShowBlankDiv()
{
    return '<div style="height:20px;"></div>';
};
var WindowDlg=function(name,content,_title,_width,_height)
{
   
    if(_width==null || _width=="undefined" || _width=="")
    {
        _width=350;
    }
    if(_height==null || _height=="undefined" | _height=="")
    {
        _height=350;
    } 
    if(_title==null || _title=="undefined" | _title=="")
    {
        _title="CTCMS";
    }  
    if($("creator_cmswindowdlg")==null)
    {
    win = new Window("creator_cmswindowdlg", {className: "alphacube", width:''+_width, height:''+_height, zIndex: 100, resizable: true,minimizable:true,maximizable:true, title: ""+_title, showEffect:Element.show, hideEffect:Effect.Fade, draggable:true})
    
    
    win.getContent().innerHTML= "<div style='padding:10px' width='100%'> "+content+"</div>"
   
    win.setDestroyOnClose();
    win.showCenter();
    return win;
    }
};
